package cn.iocoder.springboot.lab03.kafkademo.utils;

/**
 * @Author：YH
 * @Description：
 * @Date:Created in 2023/12/30 16:54
 */
public class NamespaceUtil {

    private static final String NAMESPACE_PUBLIC_KEY = "public";

    private static final String NAMESPACE_NULL_KEY = "null";

    /**
     * Treat the namespace(tenant) parameters with values of "public" and "null" as an empty string.
     *
     * @param tenant namespace(tenant) id
     * @return java.lang.String A namespace(tenant) string processed
     */
    public static String processNamespaceParameter(String tenant) {
        if (StringUtils.isBlank(tenant) || NAMESPACE_PUBLIC_KEY.equalsIgnoreCase(tenant) || NAMESPACE_NULL_KEY
                .equalsIgnoreCase(tenant)) {
            return "";
        }
        return tenant.trim();
    }
}
